local function main (userOb, msgData)
    if not msgData.id then
        return
    end

    local player = userOb:get_partner(msgData.id)
    if not player then
        local result = {}
        result.code = 400
        userOb:send_packet("MSGS2CPlayerup", result)
        return
    end

    if player.type ~= 0 then
        local result = {}
        result.code = 401
        userOb:send_packet("MSGS2CPlayerup", result)
        return
    end

    --获取主角等级
    local inlevel = userOb:get_level()
    if player.level >= inlevel then
        local result = {}
        result.code = 402
        userOb:send_packet("MSGS2CPlayerup", result)
        return
    end

    local need = math.floor(player.soul * (player.soulUp ^ (player.level - 1)))
    local soul = userOb:get_currency(GamePropIds.kGamePropIdsSoulIcon)
    if soul < need then
        local result = {}
        result.code = 403
        userOb:send_packet("MSGS2CPlayerup", result)
        return
    end

    ---! 扣除道具
    userOb:cost_currency(GamePropIds.kGamePropIdsSoulIcon, need)

    ---! 升级伙伴
    player.level = player.level + 1

    local result = {}
    result.code = 200
    result.playerid = msgData.id
    userOb:send_packet("MSGS2CPlayerup", result)
    ITEM_D:send_currency_info(userOb)

    ---! 同步伙伴排名
    RANK_D:sync_rank_data(userOb, "partner_rank")
end

--注册方法
COMMAND_D:register_command("MSGC2SPlayerup",GameCmdType.NONE, main)
